package com.drivingtheproject.wifie.data;

import android.os.Parcel;
import android.os.Parcelable;

import com.drivingtheproject.wifie.types.Mode;

/**
 * Created by Saurabh Dubey on 15.08.2014.
 */
public class Profile implements Parcelable {

    private int id;
    private String ssid;
    private String name;
    private Mode mode;
    private boolean syncOn;

    private boolean locationOn;
    private boolean bluetoothOn;
    private boolean mobileDataOn;
    private boolean enable;
    private boolean sendMessage;
    private String message;
    private String contactNumber;


    public Profile()
    {
        this.mode=Mode.Normal;
        this.syncOn=true;
        this.locationOn=true;
        this.bluetoothOn=true;
        this.mobileDataOn=true;
        this.sendMessage =false;
        this.enable=true;
    }

    public Profile(String ssid) {
        this();
        this.ssid=ssid;
        this.name=ssid;
    }

    public Profile(String ssid,String name) {
        this();
        this.ssid=ssid;
        this.name=name;
    }

    public Profile(Parcel in){

        this.id = in.readInt();
        this.ssid= in.readString();
        this.name= in.readString();
        this.mode= Mode.fromInteger(in.readInt());
        this.syncOn= in.readInt()==1;

        this.locationOn= in.readInt()==1;
        this.bluetoothOn= in.readInt()==1;
        this.mobileDataOn= in.readInt()==1;
        this.enable= in.readInt()==1;
        this.sendMessage= in.readInt()==1;
        this.message= in.readString();
        this.contactNumber= in.readString();
    }

    public static final Parcelable.Creator<Profile> CREATOR = new Parcelable.Creator<Profile>() {
        public Profile createFromParcel(Parcel pc) {
            return new Profile(pc);
        }
        public Profile[] newArray(int size) {
            return new Profile[size];
        }
    };

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getSSID() {
        return ssid;
    }

    public void setSSID(String ssid) {
        this.ssid = ssid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public boolean isSyncOn() {
        return syncOn;
    }

    public void setSyncOn(boolean syncOn) {
        this.syncOn = syncOn;
    }

    public boolean isLocationOn() {
        return locationOn;
    }

    public void setLocationOn(boolean locationOn) {
        this.locationOn = locationOn;
    }

    public boolean isBluetoothOn() {
        return bluetoothOn;
    }

    public void setBluetoothOn(boolean bluetoothOn) {
        this.bluetoothOn = bluetoothOn;
    }

    public boolean isMobileDataOn() {
        return mobileDataOn;
    }

    public void setMobileDataOn(boolean mobileDataOn) {
        this.mobileDataOn = mobileDataOn;
    }

    public Mode getMode() {
        return mode;
    }

    public void setMode(Mode mode) {
        this.mode = mode;
    }

    public boolean isEnable() {
        return enable;
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }

    public boolean isSendMessage() {
        return sendMessage;
    }

    public void setSendMessage(boolean sendMessage) {
        this.sendMessage = sendMessage;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getContactNumber() {
        return contactNumber;
    }

    public void setContactNumber(String contactNumber) {
        this.contactNumber = contactNumber;
    }

    // Parcelling part


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {

        parcel.writeInt(this.id);
        parcel.writeString(this.ssid);
        parcel.writeString(this.name);
        parcel.writeInt(this.mode.value());
        parcel.writeInt(this.syncOn?1:0);

        parcel.writeInt(this.locationOn?1:0);
        parcel.writeInt(this.bluetoothOn?1:0);
        parcel.writeInt(this.mobileDataOn?1:0);
        parcel.writeInt(this.enable?1:0);
        parcel.writeInt(this.sendMessage?1:0);

        parcel.writeString(this.message);
        parcel.writeString(this.contactNumber);
    }
}
